Subject: Hackers corner: A sed script for decoding quoted printable
From: "David Herron" <[email-masked]>
To: MM Discussions <[email-masked]>, IETF-822 Discussion <[email-masked]>
Date: Tue, 26 Jan 93 10:05:31 PST

Last night I was setting up an emailable archive server on my home system
(servicemail makes some things so easy).  The fact that it insists on returning
files in quoted printable or base64 is a compatibility problem since most
people don't have either.  So, as the first stage in boostrapping users
to being able to decode these files the following was written.  The next
step is leaving a standalone copy of the mimencode source on the server.

Nathaniel, I offer this up to the contrib part of the metamail distribution.

It misses the octets from =80 to =FF.  It has been tested to properly
decode all the files on my archive server and doesn't crap out when the
original text has a trailing equal-sign (=).  Since it has some control
characters I'll include a uuencoded version as well.

USAGE:	sed -f qpdecode.sed <input >output

: top
s/=01//g
s/=02//g
s/=03//g
s/=04//g
s/=05//g
s/=06//g
s/=07//g
s/=08//g
s/=09/	/g
s/=0[aA]/\
/g
s/=0[bB]//g
s/=0[cC]//g
s/=0[dD]//g
s/=0[eE]//g
s/=0[fF]//g
s/=10//g
s/=11//g
s/=12//g
s/=13//g
s/=14//g
s/=15//g
s/=16//g
s/=17//g
s/=18//g
s/=19//g
s/=1[aA]//g
s/=1[bB]//g
s/=1[cC]//g
s/=1[dD]//g
s/=1[eE]//g
s/=1[fF]//g
s/=2[eE]/./g
/=$/{
	N
	s/=\n//g
	b top
}
s/=3[dD]/=/g